package com.atguigu;

import org.junit.Test;
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;

/**
 * @author fenge
 */
public class TestSpringSecurity {
    @Test
    public void testSpringSecurity(){
        BCryptPasswordEncoder encoder = new BCryptPasswordEncoder();
        String abc = encoder.encode("abc");
        //$2a$10$aR6PeTvA6JbpC8EQAhr..OlTspMiTx7sBhfmmgadOCgAQc7kv5bua
        //$2a$10$pby2luPylneZpHGaFV5PbOUt9KZ80PqO0tSnxDnR6v7rd7Mj8Qbp6
        System.out.println(abc);
        String abc1 = encoder.encode("abc");
        System.out.println(abc1);
        //$2a$10$kJp5.8btNNXsV1Lr5awxsOYk0Fwoj299QCFQvGJAAbo2CMRwlTIVi
        //$2a$10$Qvv.OWtrXxCq1PuPi741DeiY3Hjl9mJkob.VLd/cWtRDXh35lOLUG

        boolean b = encoder.matches("abc","$2a$10$dyIf5fOjCRZs/pYXiBYy8uOiTa1z7I.mpqWlK5B/0icpAKijKCgxe");
        System.out.println(b);
    }
}
